package com.adv.netWork01;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class Work02_ip {

	public static void main(String[] args) throws Exception {
		// 百度
		InetAddress[] add1 = InetAddress.getAllByName("www.baidu.com");
		for (InetAddress add : add1) {
			System.out.println(add.getHostName());
			System.out.println(add.getHostAddress());
		}
		System.out.println(">>>>>>>>>>>>>>>>>我是分隔符>>>>>>>>>>>>>>>>>>>>>");
		// 网易
		InetAddress[] add2 = InetAddress.getAllByName("www.163.com");
		for (InetAddress add : add2) {
			System.out.println(add.getHostName());
			System.out.println(add.getHostAddress());
		}
		System.out.println(">>>>>>>>>>>>>>>>>我是分隔符>>>>>>>>>>>>>>>>>>>>>");
		// 网易
		InetAddress[] add3 = InetAddress.getAllByName("alibaba.com");
		for (InetAddress add : add3) {
			System.out.println(add.getHostName());
			System.out.println(add.getHostAddress());
		}
		System.out.println(">>>>>>>>>>>>>>>>>我是分隔符>>>>>>>>>>>>>>>>>>>>>");
		// 网易
		InetAddress[] add4 = InetAddress.getAllByName("taobao.com");
		for (InetAddress add : add4) {
			System.out.println(add.getHostName());
			System.out.println(add.getHostAddress());
		}
	}

}
